<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="/the-good-thing-of-wang-feizhai/vue_basic/js/vue.js"></script>
    <div id="root">
        <cpn></cpn>
    </div>

    <!-- 创建组件模板 -->
    <template id="cpnT1">
        <div>
            <h2>当前计数:{{num}}</h2>
            <button @click="increase">+</button>
            <button>-</button>
        </div>
    </template>


    <script>


        // 创建组件对象
        const cpn = {
            template:'#cpnT1',
            data(){
                return{
                    num:0
                }
            },
            methods:{
                increase(){
                    this.num++;
                },
            }
        }


        new Vue({
            el:'#root',
            data(){
                return{
                    num:1,
                }
            },
            methods: {
            },
            components:{
                cpn:cpn
            }
        })
    </script>
</body>
</html>